package com.itheima.controller;

import com.itheima.entity.Product;
import com.itheima.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author I'm Superhero
 * @date 2021/5/25
 */

@Controller
public class IndexController {

    @Autowired
    private ProductService productService;

    @RequestMapping("/")
    public String index(Model model) {

        //获取所有商品
        List<Product> products = productService.queryAllByLimit(0, 100);
        model.addAttribute("list", products);
        return "index";
    }

}
